public class wxudong {

	private static class Node{
		String data;
		Node next;

		public Node(String data){
			this.data = data;
		}
	}

	private static Node deleteNode(Node node, int n){
		Node one = node;
		Node two = node;
		int i = 0;
		while(one.next != null){
			i++;
			if(i > n){
				two = two.next;
			}
			one = one.next;
		}
		if(i < n){
			node = node.next;
			return node;
		}
		Node temp = two.next;
		two.next = temp.next;
		return node;
	}

	private static void print(Node node) {
        Node indexNode = node;
        while (indexNode != null) {
            System.out.print(indexNode.data);
            indexNode = indexNode.next;
        }
    }

	public static void main(String[] args){
		Node head = new Node("1");
		Node temp = head;
        for (int i = 2; i < 10; i++) {
            Node newNode = new Node(i + "");
            temp.next = newNode;
            temp = newNode;
        }
        head = deleteNode(head, 5);
        print(head);
	}

}
